
import UIKit

extension UIView {
    //便利视图的响应者链条  获取导航视图控制器
    func navViewcontroller() ->UINavigationController? {
        //便利视图的响应者链条
        //获取视图的想一个响应者
        var next = nextResponder()
        while next != nil {
            if let nextobj = next as? UINavigationController {
                return nextobj
            }
            next = next?.nextResponder()
        }
        return nil
    }
}